#include "Camera.h"

using namespace irr;
using namespace core;


Camera::Camera(scene::ICameraSceneNode *camera){
    m_camera = camera;
}

void Camera::moveFront(){

    matrix4 m = m_camera->getAbsoluteTransformation();
    matrix4 front_move;
    front_move.setTranslation(vector3df (0,0,5.0f));
    m_camera->setPosition((m*front_move).getTranslation());

}

void Camera::moveBack(){

    matrix4 m = m_camera->getAbsoluteTransformation();
    matrix4 back_move;
    back_move.setTranslation(vector3df (0,0,-5.0f));
    m_camera->setPosition((m*back_move).getTranslation());

}

void Camera::moveLeft(){

    matrix4 m = m_camera->getAbsoluteTransformation();
    matrix4 right_move;
    right_move.setTranslation(vector3df (-5.0f,0,0));
    m_camera->setPosition((m*right_move).getTranslation());

}
void Camera::moveRight(){

    matrix4 m = m_camera->getAbsoluteTransformation();
    matrix4 right_move;
    right_move.setTranslation(vector3df (5.0f,0,0));
    m_camera->setPosition((m*right_move).getTranslation());

}

void Camera::rotateYaw(const irr::f32 yaw){
    vector3df v = m_camera->getRotation ();
    m_camera->setRotation(vector3df(v.X,v.Y+yaw,v.Z));
	

    //std::cout << "Angle horizontal " << yaw << std::endl;
}

void Camera::rotateYawLunettes(const irr::f32 yaw){
    vector3df v = m_camera->getRotation ();
    //m_camera->setRotation(vector3df(v.X,v.Y+yaw,v.Z));
	m_camera->setRotation(vector3df(v.X,yaw,v.Z));

    //std::cout << "Angle horizontal " << yaw << std::endl;
}

void Camera::rotatePitch(const irr::f32 pitch){
    vector3df v = m_camera->getRotation ();
   m_camera->setRotation(vector3df(v.X+pitch,v.Y,v.Z));
	

    //std::cout << "Angle vertical :" << pitch <<  std::endl ;
}

void Camera::rotatePitchLunettes(const irr::f32 pitch){
    vector3df v = m_camera->getRotation ();
   // m_camera->setRotation(vector3df(v.X+pitch,v.Y,v.Z));
	m_camera->setRotation(vector3df(pitch,v.Y,v.Z));

    //std::cout << "Angle vertical :" << pitch <<  std::endl ;
}

